package org.btik.light.server.platform.common.api.bean.settings;

import org.btik.light.cache.CurrentMemCachePo;

import java.util.HashMap;
import java.util.Map;
import java.util.Objects;

import static org.btik.light.server.platform.common.api.service.SystemSettingsService.SYSTEM_SETTINGS;

/**
 * @author lustre
 * @since 2023/6/29 18:48
 */
public class SystemSettings implements CurrentMemCachePo<SystemSettings> {

    private String key = SYSTEM_SETTINGS;

    private HashMap<String, String> values;

    public HashMap<String, String> getValues() {
        return values;
    }

    @Override
    public String key() {
        return key;
    }

    @Override
    public void setKey(String key) {
        Objects.requireNonNull(key);
        this.key = key;
    }

    public void setValues(Map<String, String> values) {
        this.values = new HashMap<>(values);
    }

    @Override
    public SystemSettings copy(SystemSettings po) {
        this.values = new HashMap<>(po.values);
        return this;
    }

    @Override
    public SystemSettings newCopy() {
        SystemSettings systemSettings = new SystemSettings();
        systemSettings.copy(this);
        return systemSettings;
    }


}
